<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
	<h4 align="center">所有进货单</h4>
	<table border="1" cellspacing="0" cellpadding="3" align="center">
		<tr>
		<th>ID</th>
		<th>商品ID</th>
		<th>名称</th>
		<th>数量</th>
		<th>时间</th>
		<th>状态</th>
		</tr>
		<c:forEach items="${requestScope.purchases }" var="p">
			<tr>
				<td>${p.id }</td>
				<td>${p.goodsId }</td>
				<td>${p.goodsName }</td>
				<td>${p.number }</td>
				<td><fmt:formatDate type="both" value="${p.time}"/></td>
				<c:set var="s" value="${p.states }"/>
				<c:choose>
					<c:when test="${s==0 }">
						<td>
							<a href="${pageContext.request.contextPath }/goods/purchased/${p.id}">进货</a>
						</td>
					</c:when>
					<c:when test="${s==1 }">
						<td>已完成进货</td>
					</c:when>
				</c:choose>
			</tr>
		</c:forEach>
	</table>
	<form action="${pageContext.request.contextPath }/contract/toPage/login/storeAdminPage" method="post"
		 style="width: 30%; margin: auto">
			<input type="submit" value="返回">
		</form>
</body>
</html>